#pragma once
#include<vector>
#include "GWListenThread.h"
#include "GWNetDef.h"

class GWMsgMan : public GWListenThread 
{
public:
	GWMsgMan(void);
	~GWMsgMan(void);

public:
	VOID InitConfig();

public:
	int GWStart();
	int GWStop();

private:
	virtual int vTcpCmdDispatch(SOCKET hClientSocket,NET_PACKET_HEAD *pMsgHead,BYTE *pBuffer);
	virtual int vUdpCmdDispatch(SOCKET hSocket,TG_UDP_ADDR *pAddr,NET_PACKET_HEAD *pMsgHead,BYTE *pBuffer);


private:
	int UpdateCsInfo(TcsPingGW *pTcs,char *pCsIP,int nCsPort);
	int GetCsInfo(int nSelect,RetTcsInfo *pTcsInfo);

private:
	UINT16 m_nPort;


private:
	TGCriticalSection   m_Sect;
	std::vector<TcsInfo>m_arCsInfo;

};
